package 面试刷题;

import org.junit.Test;

import java.util.Arrays;

public class 水题 {
    public double minimumAverage(int[] nums) {
        Arrays.sort(nums);
        double mini = Double.MAX_VALUE;
        for (int i = 0, j = nums.length - 1; i < j; i++, j--) {
            mini = Math.min(mini, (nums[i] + nums[j]) / 2.0);
        }
        return mini;
    }


    @Test
    public void init() {
        int[] arr = {7, 8, 3, 4, 15, 13, 4, 1};
        double v = minimumAverage(arr);
        System.out.println(v);
    }
}
